package com.ruoyi.system.controller;

import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.system.domain.DataScreeningPersonnelUav;
import com.ruoyi.system.service.IDataScreeningPersonnelUavService;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.core.web.page.TableDataInfo;

/**
 * 被核查人员无人机Controller
 * 
 * @author ruoyi
 * @date 2024-06-25
 */
@RestController
@RequestMapping("/uav")
public class DataScreeningPersonnelUavController extends BaseController
{
    @Autowired
    private IDataScreeningPersonnelUavService dataScreeningPersonnelUavService;

    /**
     * 查询被核查人员无人机列表
     */
    @RequiresPermissions("system:uav:list")
    @GetMapping("/list")
    public TableDataInfo list(DataScreeningPersonnelUav dataScreeningPersonnelUav)
    {
        startPage();
        List<DataScreeningPersonnelUav> list = dataScreeningPersonnelUavService.selectDataScreeningPersonnelUavList(dataScreeningPersonnelUav);
        return getDataTable(list);
    }

    /**
     * 导出被核查人员无人机列表
     */
    @RequiresPermissions("system:uav:export")
    @Log(title = "被核查人员无人机", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, DataScreeningPersonnelUav dataScreeningPersonnelUav)
    {
        List<DataScreeningPersonnelUav> list = dataScreeningPersonnelUavService.selectDataScreeningPersonnelUavList(dataScreeningPersonnelUav);
        ExcelUtil<DataScreeningPersonnelUav> util = new ExcelUtil<DataScreeningPersonnelUav>(DataScreeningPersonnelUav.class);
        util.exportExcel(response, list, "被核查人员无人机数据");
    }

    /**
     * 获取被核查人员无人机详细信息
     */
    @RequiresPermissions("system:uav:query")
    @GetMapping(value = "/{uavId}")
    public AjaxResult getInfo(@PathVariable("uavId") Long uavId)
    {
        return AjaxResult.success(dataScreeningPersonnelUavService.selectDataScreeningPersonnelUavByUavId(uavId));
    }

    /**
     * 新增被核查人员无人机
     */
    @RequiresPermissions("system:uav:add")
    @Log(title = "被核查人员无人机", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody DataScreeningPersonnelUav dataScreeningPersonnelUav)
    {
        return toAjax(dataScreeningPersonnelUavService.insertDataScreeningPersonnelUav(dataScreeningPersonnelUav));
    }

    /**
     * 修改被核查人员无人机
     */
    @RequiresPermissions("system:uav:edit")
    @Log(title = "被核查人员无人机", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody DataScreeningPersonnelUav dataScreeningPersonnelUav)
    {
        return toAjax(dataScreeningPersonnelUavService.updateDataScreeningPersonnelUav(dataScreeningPersonnelUav));
    }

    /**
     * 删除被核查人员无人机
     */
    @RequiresPermissions("system:uav:remove")
    @Log(title = "被核查人员无人机", businessType = BusinessType.DELETE)
	@DeleteMapping("/{uavIds}")
    public AjaxResult remove(@PathVariable Long[] uavIds)
    {
        return toAjax(dataScreeningPersonnelUavService.deleteDataScreeningPersonnelUavByUavIds(uavIds));
    }
}
